cmake_minimum_required (VERSION 3.16.0)

# projectname is the same as the main-executable
project(iosvr)

# 添加编译选项
add_compile_options(-std=c++17)

if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_compile_options(-g)
add_compile_options(-Wall)
endif()

if(${CMAKE_BUILD_TYPE} MATCHES "Release")
add_compile_options(-Wall)
endif()

add_link_options(-rdynamic)

# 查找当前目录中的所有源文件，并将结果列表存放在变量DIR_SRCS中
include_directories(Buffer .)   # MemPool
# aux_source_directory(MemPool DIR_SRCS)
aux_source_directory(Buffer DIR_SRCS)
aux_source_directory(. DIR_SRCS)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../build/iosvr)

# 指定可执行文件名称，PROJECT_NAME是前面定义的project名称
add_executable(${PROJECT_NAME} ${DIR_SRCS})
target_link_libraries(${PROJECT_NAME} pthread ssl crypto dl)
